[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getpalettesize()        Get Size of Current Palette

 #include   <graphics.h>

 int far getpalettesize(void);

        The getpalettesize() function returns the number of palette
        entries allowed for the current palette.

    Returns:    The number of allowed palette entries.

   -------------------------------- Example ---------------------------------

    The following statements fill a rectangle with all the available
    colors.

           #include <graphics.h>
           #include <conio.h>

           int gdriver = DETECT;
           int gmode;

           main()
           {
               int whcolor, palsize;

               initgraph(&gdriver,&gmode,"");
               palsize = getpalettesize());
               for (whcolor = 0; whcolor < palsize; whcolor++) {
                   setfillstyle(SOLID_FILL,whcolor);
                   rectangle(100,100,200,150);
                   floodfill(110,110,WHITE);
                   getch();
               }
               closegraph();
           }


See Also: getpalette() setallpalette() setpalette()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson